﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _02数组
{
    class Program
    {
        static void Main(string[] args)
        {

            #region //声明方式一
            /*int size = 12;          
            int[]  monthArr = new int[size];
            //访问方式一
            //修改数组的每一个元素
            for (int i = 0; i < monthArr.Length; i++)
            {
                monthArr[i] = i * 10;//修改每个元素的值
                //Console.WriteLine(monthArr[i]);
            }
            //访问方式二(只读遍历)
            foreach(int num in monthArr)
            {
                //num *= 10;
                Console.WriteLine(num);
            }
            */
            #endregion//声明方式一
            #region //声明方式二
            int[] bymonthDayArr = new int[13]{0,31,28,31,30,31,30,31,31,30,31,30,31};
            //访问数组元素
            /*foreach (var dayNum in bymonthDayArr)
            {
                Console.WriteLine(dayNum);
            }*/
            //Console.WriteLine("请输入年/月/日:");
            /* string str = "2020/12/31";
             //拆分字符串
             char[] separtor = { '/' };
             string[] strArr = str.Split(separtor);
             int year = int.Parse(strArr[0]);//年
             int month = int.Parse(strArr[1]);//月
             int day = int.Parse(strArr[2]);//日
             int sum = 0;
             for(int i=1;i< month; i++)
             {
                 sum += bymonthDayArr[i];
             }
             sum += day;
             //判断闰年
             if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0))
             {
                 sum += 1;
                 //Console.WriteLine("是闰年");
             }
             Console.WriteLine($"这是一年中的第{sum}天");
             */
            #endregion
            #region//二维数组
            //声明并初始化
            /* int[,] nineBoxArr ={ 
                 { 4,9,2},
                 { 3,5,7},
                 { 8,1,6}
             };
             //Console.WriteLine(nineBoxArr[0,0]+ nineBoxArr[0, 1] + nineBoxArr[0, 2]);
             for(int i=0;i< 3; i++)
             {
                 for (int j = 0; j < 3; j++)
                 {
                     Console.Write(nineBoxArr[i,j] + " ");
                 }
                 Console.WriteLine();
             }
            */

            #endregion

            int[] numbers = new int[4] {0,1,2,3};

        }
    }
}
